import ReactEcharts from 'echarts-for-react';
import React from 'react';
import {Layout, Modal} from 'antd';
import './index.less';
import {connect} from "dva";
import BaseComponent from "components/Base/BaseComponent";
const {Content, Footer, Header} = Layout;

@connect(({ecgSession}) => ({ecgSession}))
export default class extends BaseComponent {
  getNamespace() {
    return "service";
  }

  myRef = React.createRef();
  componentDidMount() {
    this.refresh();

    this.timer = setInterval(() => {
      this.refresh();
      console.log(this.props)
    }, 5000)
  }

  refresh = ()=>{
    this.dispatch({
      type: `${this.getNamespace()}/CPU`,
      payload: {
        notice: this.showMsg
      },success: (res) => {
        console.log(res)
      }

    })
  }

  componentWillUnmount() {
    clearInterval(this.timer);
  }

  state = {
    data: [],
    numeration:[]
  }
  getOption = () => ( {
    series: [
      {
        name: '业务指标',
        type: 'gauge',
        detail: {formatter: '{value}%'},
        data: [{value: 50, name: '完成率'}]
      }
    ]
  });
  render() {

    return (
      <div>
        <ReactEcharts
          ref={this.myRef}
          option={this.getOption()} />
      </div>
    );
  }
}

